<template>
  <div>
    <!--  三级联动全局组件，不需要引入-->
    <TypeNav />
    <!--  轮播图列表-->
    <ListContainer />
    <!--  今日推荐-->
    <Recommend />
    <!--  商品排行-->
    <Rank />
    <!--  猜你喜欢-->
    <Like />
    <!-- 楼层 -->
    <Floor v-for="floor in floorList" :key="floor.id" :list="floor" />
    <!--  商标-->
    <Brand />
  </div>
</template>

<script>
import ListContainer from "./ListContainer";
import Recommend from "./Recommend";
import Rank from "./Rank";
import Like from "./Like";
import Floor from "./Floor";
import Brand from "./Brand";
import { mapState } from "vuex";
export default {
  name: "Home",
  components: {
    ListContainer,
    Recommend,
    Rank,
    Like,
    Floor,
    Brand,
  },
  // 组件挂载完毕，请求floor数据和用户信息
  mounted() {
    this.$store.dispatch("getFloorList");
    this.$store.dispatch("getUserInfo");
  },
  computed: {
    ...mapState({
      floorList: (state) => state.home.floorList,
    }),
  },
};
</script>

<style scoped></style>
